﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace GameSPK
{
    /// <summary>
    /// Interaction logic for frmGenerel.xaml
    /// </summary>
    public partial class frmGenerel : Window
    {
        public frmGenerel()
        {
            InitializeComponent();
        }
        public Grid generalMainGrid
        {
            get { return gridMain; }
            set { gridMain = value; }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CauHinhChung cauhinh = CauHinhChung.getInstance();
            try
            {
                lblBanner.Margin = new Thickness(cauhinh.mBanner.left, cauhinh.mBanner.top, 0, 0);

                lblBanner.Width = cauhinh.mBanner.width;
                lblBanner.Height = cauhinh.mBanner.height;
                lblBanner.Content = cauhinh.mBanner.content;
                lblBanner.FontSize = cauhinh.mBanner.fontsize;
                Color backcolor = (Color)ColorConverter.ConvertFromString(cauhinh.mBanner.background);
                SolidColorBrush brush;
                brush = new SolidColorBrush(backcolor);
                lblBanner.Background = brush;
                Color forecolor = (Color)ColorConverter.ConvertFromString(cauhinh.mBanner.foreground);
                SolidColorBrush brushfore;
                brushfore = new SolidColorBrush(forecolor);
                lblBanner.Foreground = brushfore;
                ImageBrush myBrush = new ImageBrush();
                myBrush.ImageSource =
                       new BitmapImage(new Uri(cauhinh.imagebackground, UriKind.RelativeOrAbsolute));
                Background = myBrush;
            }
            catch
            {
                this.Close();
            }
        }
        
        protected virtual void EndForm()
        {
        }

        private void Window_Closed(object sender, EventArgs e)
        {
            CauHinhChung.huy();
           
        }
        
    }
}
